package com.scedu.dao;

import com.scedu.entity.User;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Component;

import java.util.List;

public class UserMapperImpl implements UserMapper {
    //原来：我们的所有操作都使用sqlsession来执行
    //现在：都使用SqlSessionTemplate
    private SqlSessionTemplate sqlSessionTemplate;

    public void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate) {
        this.sqlSessionTemplate = sqlSessionTemplate;
    }

    public List<User> selectUser() {
        UserMapper mapper = sqlSessionTemplate.getMapper(UserMapper.class);
        List<User> userList=mapper.selectUser();
        return userList;
    }
}
